package jobs;

// 统一音频播放接口
interface AudioPlayer {
    void play();
}

// 旧音频类
class OldAudio {
    private String fileName;
    public OldAudio(String fileName) {
        this.fileName = fileName;
    }
    public void playOld() {
        System.out.println("播放旧音频: " + fileName);
    }
}

// 适配器类
class AudioAdapter implements AudioPlayer {
    private OldAudio oldAudio;
    public AudioAdapter(OldAudio oldAudio) {
        this.oldAudio = oldAudio;
    }
    @Override
    public void play() {
        oldAudio.playOld();
    }
}

// 测试类
public class AudioAdapterTest {
    public static void main(String[] args) {
        OldAudio oldAudio = new OldAudio("music.mp3");
        AudioPlayer player = new AudioAdapter(oldAudio);
        System.out.println("通过统一play方法播放:");
        player.play();
    }
}
